//
//  ZZMessageCell.m
//  QQplayground
//
//  Created by zhangxy on 2018/7/20.
//  Copyright © 2018年 zhang. All rights reserved.
//

#import "ZZMessageCell.h"

@implementation ZZMessageCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    
    _imgAvatar.layer.masksToBounds = YES;
    _imgAvatar.layer.cornerRadius =  22.0f;
    
    [_labName setTextColor:UIColorFromRGB(TextSizeOneColor)];
    [_labName setFont:FontFiftent];
    
    [_labTime setTextColor:UIColorFromRGB(TextSizeEightColor)];
    [_labTime setFont:FontThirteen];
    
    [_labDesc setTextColor:UIColorFromRGB(Text6Color)];
    [_labDesc setFont:FontFiftent];
}

-(void)dataToView:(MessageEntity *)obj{
    if(obj){
        [_imgAvatar sd_setImageWithURL:[NSURL URLWithString:convertToString(obj.user_info.user_avatar)] placeholderImage:[UIImage imageNamed:@"default_image"]];
        [_labName setText:convertToString(obj.user_info.user_name)];
        [_labDesc setText:convertToString(obj.message)];
        
        [_labTime setText:obj.add_time];
    }
}

-(void)letterDataToView:(LetterEntity *)obj{
    if(obj){
        [_imgAvatar sd_setImageWithURL:[NSURL URLWithString:convertToString(obj.from_user_info.user_avatar)] placeholderImage:[UIImage imageNamed:@"default_image"]];
        [_labName setText:convertToString(obj.from_user_info.user_name)];
        [_labDesc setText:convertToString(obj.message)];
        
        [_labTime setText:obj.add_time];
    }
}

-(void)mimiDataToView:(ZZMimiEntity *)obj{
    if(obj){
        [_imgAvatar sd_setImageWithURL:[NSURL URLWithString:convertToString(obj.user_info.user_avatar)] placeholderImage:[UIImage imageNamed:@"default_image"]];
        [_labName setText:convertToString(obj.user_info.user_name)];
        [_labDesc setText:convertToString(obj.message)];
        
        [_labTime setText:obj.add_time];
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
